package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * ClassName: LeaseException
 * Package: com.atguigu.lease.common.exception
 * Description:
 *
 * @Autor: xvyy
 * @Create: 2024/11/18 - 19:49
 * @Version: v1.0
 */
@Data
public class LeaseException extends RuntimeException {

    //异常状态码
    private Integer code;

    public LeaseException() {
    }

    public LeaseException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public LeaseException(ResultCodeEnum resultCodeEnum) {
        this(resultCodeEnum.getCode(), resultCodeEnum.getMessage());
    }

        @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }
}